/*   
 * Copyright (c) 2010-2020 Founder Ltd. All Rights Reserved.   
 *   
 * This software is the confidential and proprietary information of   
 * Founder. You shall not disclose such Confidential Information   
 * and shall use it only in accordance with the terms of the agreements   
 * you entered into with Founder.   
 *   
 */
package com.wujw.auto.utils;

import java.io.FileReader;

import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;


/**   
 * Json配置文件测试  
 * @author wujw  
 * @version   
 *       1.0, 2017年11月12日   
 */
@Deprecated 
public class ReadJsonConfigUtil {
    public static void main(String[] args) throws Exception {
        JsonParser parser=new JsonParser();  //创建JSON解析器
        String pathname=ReadJsonConfigUtil.class.getClassLoader().getResource("config.json").getPath();; 
        JsonObject object=(JsonObject) parser.parse(new FileReader(pathname));  //创建JsonObject对象
        
        
        String url = object.get("jdbc.url").getAsString();
        boolean beanflag = object.get("beanFlag").getAsBoolean();
        System.out.println(beanflag);
        System.out.println(url);
        
        JsonArray array = object.get("tables").getAsJsonArray();
        for (int i = 0; i < array.size(); i++) {
            JsonObject subObject = array.get(i).getAsJsonObject();
            System.out.println(subObject.get("table").getAsString());
        }
    }
}
